package com.gw2.gw2world.controller;

import java.util.List;

import com.gw2.gw2world.R;
import com.gw2.gw2world.model.Map;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

public class MapAdapter extends ArrayAdapter<Map> {
	@SuppressWarnings("unused")
	private static final String TAG="MapAdapter";
	//private List<Map> list;
	public MapAdapter(Context c, List<Map> v) {
		super(c, android.R.layout.simple_spinner_item, v);
		setDropDownViewResource(R.layout.map_adapter);
		//list=v;
	}
	
	@Override
	public View getDropDownView(int position, View convertView, ViewGroup parent) {
		if(convertView==null) {
			LayoutInflater inflater = (LayoutInflater)getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
			convertView = inflater.inflate(R.layout.map_adapter, parent, false);
		}
		TextView tv_map = (TextView)convertView.findViewById(R.id.tv_map_name);
		tv_map.setTag(getItem(position));
		tv_map.setText(getItem(position).name);
		return convertView;
	}
	/*public List<Map> getItems() {
		return list;
	}*/
}
